<?php
//Overdue Checker
include "connect.php";
$sql = mysql_query("SELECT * FROM books WHERE checkout = 'out'");
$date= date();
$timeallowed = 1209600;
$numoverdue = 0;
$numout = 0;
while ($row = mysql_fetch_array($sql)){
$out = $row['duedate'];
$barcode = $row['barcode'];
$outto = $row['outto'];
$time = $out - $date;
$numout++;
if ($time > $timeallowed) {
$overdue = mysql_query("SELECT overdue FROM patrons WHERE code = $outto");
$added = $overdue + 1;
mysql_query("UPDATE patrons SET overdue = overdue+1 WHERE code = $outto");
mysql_query("UPDATE books SET duedate = duedate+86400 WHERE barcode = $barcode");
$numoverdue++;

}
}
echo $numoverdue;
echo $numout;
		echo $time;
?>